package com.neusoft.a312cxy.android18cxy.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.neusoft.a312cxy.android18cxy.R;
import com.neusoft.a312cxy.android18cxy.adapter.myshaituAdapter;
import com.neusoft.a312cxy.android18cxy.bean.MyShaituBean;
import com.neusoft.a312cxy.android18cxy.model.MySelfModel;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by Young on 2017/11/2.
 */

public class MyshaituActivity extends AppCompatActivity {
    private String id;
    private RecyclerView myshaitu;
    private List mDatelist;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_myshaitu);
        initView();
        saveDate();
        Getmyshaitu();

    //    reply_userid="2";
        //  getShaiTureply();




    }
    public void initView(){
        myshaitu = (RecyclerView) findViewById(R.id.myshaitu);
        myshaitu.setLayoutManager(new LinearLayoutManager(MyshaituActivity.this));
        myshaitu.setItemAnimator(new DefaultItemAnimator());
    }

    public void saveDate(){
        Intent intent = getIntent();
        Bundle bundle = intent.getExtras();
        //  shaitu_id = bundle.getString("shaitu_id");
        id = bundle.getString("userid");
    }

    public void     Getmyshaitu(){
        final MySelfModel MySelfModel=new MySelfModel();
        Call<MyShaituBean> call=MySelfModel.getmyshaitu("19","1","shaitu");
        call.enqueue(new Callback<MyShaituBean>() {
            @Override
            public void onResponse(Call<MyShaituBean> call, Response<MyShaituBean> response) {
                List<MyShaituBean.ShaituBean> data = response.body().getShaitu();
                //  System.out.println("9");
                myshaitu.setAdapter(new myshaituAdapter(MyshaituActivity.this, data));

               // myshaitu.setAdapter();
            }
            @Override
            public void onFailure(Call<MyShaituBean> call, Throwable t) {

            }
        });
    }

}
